package com.aiyan.edu.framework.web;

import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * 控制器基类
 *
 * @author: zqzhou
 * @create: 2019/10/05 23:22
 **/
public class BaseController {

    /**
     * 请求
     */
    protected HttpServletRequest request;

    /**
     * 响应
     */
    protected HttpServletResponse response;

    /**
     * session
     */
    protected HttpSession session;

    /**
     * 设置请求/响应/session
     *
     * @param request
     */
    @ModelAttribute
    public void setReqAndRes(HttpServletRequest request, HttpServletResponse response) {
        this.request = request;
        this.response = response;
        this.session = request.getSession();
    }
}
